﻿@model IEnumerable<Model.Object.Nhom>
@{
    var loaisanpham = (List<Model.Object.LoaiSanPham>)ViewBag.loaisanpham;
    var nhom = (List<Model.Object.Nhom>)ViewBag.nhom;
}
<nav class="queldorei">
    <div class="nav-top-title">
        <div class="icon"><span></span><span></span><span></span></div>
        <a href="#">Menu</a>
    </div>
    <ul id="queldoreiNav">

        @for (int i = 0; i < nhom.Count(); i++)
        {
            bool kt = false;
            <li class="level0 nav-"+ @i+1+ " level-top first parent">
                <a href="#" class="level-top">
                    <span>@nhom[i].Ten_nhom</span>
                </a>
                
                @for (int j = 0; j < loaisanpham.Count(); j++)
                {
                    if (loaisanpham[j].ID_Nhom == nhom[i].ID)
                    {
                        kt = true;
                    }
                }
                @if(kt==true){
                <div class="sub-wrapper">
                    <ul class="level0">
                        <li>
                            <ol>
                                @for (int j = 0; j < loaisanpham.Count(); j++)
                                {
                                    if (loaisanpham[j].ID_Nhom == nhom[i].ID)
                                    {
                                        if (j < loaisanpham.Count - 1)
                                        {
                                    <li class="level1 nav-"+ @i+1 +"-"+ @j+1 +" first">
                                        <a href="@Url.Action("XemChiTietLoaiSanPham", "Home", new {id= loaisanpham[j].ID,tenloai=Nongsan.StringUils.UrlRewrite( loaisanpham[j].Ten_Loai)})">
                                            <span>@loaisanpham[j].Ten_Loai</span>
                                        </a>
                                    </li>
                                    
                                        }
                                        else{
                                            <li class="level1 nav-"+ @i+1 +"-"+ @j+1 +" last">
                                        <a href="@Url.Action("XemChiTietLoaiSanPham", "Home", new {id= loaisanpham[j].ID,tenloai=Nongsan.StringUils.UrlRewrite( loaisanpham[j].Ten_Loai)})">
                                            <span>@loaisanpham[j].Ten_Loai</span>
                                        </a>
                                    </li>
                                        }
                                    }
                                }

                            </ol>
                        </li>
                    </ul>
                </div>
                }
            </li>
        }

  
    </ul>
</nav>
